package com.shiwenping.reply.fragment;

import android.databinding.DataBindingUtil;
import android.databinding.ViewDataBinding;
import android.os.Bundle;
import android.support.annotation.LayoutRes;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

/**
 * @author shiwenping
 * @date 17-11-6 下午5:14
 */

public abstract class BaseFragment<T extends ViewDataBinding> extends Fragment {
    //绑定UI
    protected T databinding;

    @LayoutRes
    abstract int resLayout();

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        databinding = DataBindingUtil.inflate(inflater, resLayout(), container, false);
        return databinding.getRoot();
    }

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        initViewer();
        initListener();
        initAdapter();
    }

    public void initAdapter(){

    }

    public void initViewer()
    {

    }

    public void initListener(){

    }
}
